package com.maixun.lib_choosefile.entity

import android.os.Parcelable
import kotlinx.android.parcel.Parcelize

/**
 * @author：Lmoumou
 * @date：2020/9/30
 */
@Parcelize
data class LocalFileIm(
    var path: String = "",
    var name: String = "",
    var lastModifyTime: Long = 0,
    var isRead: Boolean = false,
    var fileSize: Long = 0,
    var isSelect: Boolean = false,
    var dataSize: String = "0",
    var dataDate: String = "0",
    var type: FileType = FileType.DEFAULT,
    var isData: Boolean = false
) : FileItem, Comparable<LocalFileIm>, Parcelable {
    override fun getFileName(): String {
        return name
    }

    override fun getFileType(): FileType {
        return type
    }

    override fun getFilePath(): String = path

    override fun isLocal(): Boolean = true
    override fun compareTo(other: LocalFileIm): Int {
        return if (isData) {
            if (lastModifyTime - other.lastModifyTime > 0) -1 else 1
        } else name.compareTo(other.name)
    }


}